{include file="lib/header.html"}
<!--main-->
<div id="main">
  {include file="lib/history.html"}
	<div class="breadcrumb">
	  <a href="?url=index">首页</a> <img src="{gen_theme_url('images/i.png')}" class="ico"> <a href="?url=menu">菜单列表</a> <img src="{gen_theme_url('images/i.png')}" class="ico">
	</div>
	{if $info.id}
	<form action="?url=menu/update&id={$info.id}" method="post" accept-charset="utf-8">
	{else}
	<form action="?url=menu/create" method="post" accept-charset="utf-8">
	{/if}
	<div class="clearfix m10">
		<div class="sidebar">
		  <div class="m10">
		  所属上级:
		  <select name="info[parent_id]">
		    <option value="0">无</option>
		    {foreach $parent as $val}
		    <option value="{$val.id}"{if $info.parent_id == $val.id} selected{/if}>{$val.name}</option>
		    {/foreach}
		  </select>
		  </div>
		  <div class="m10"{if not $info.parent_id} style="display:none"{/if}>
        链接:
		    <select name="info[url]">
		      {foreach Config::get('menu') as $val}
		        {foreach $val as $v}
		          <option value="{$v@key}"{if $info.url == $v} selected{/if}>{$v.name}</option>
		        {/foreach}
		      {/foreach}
		    </select>
		  </div>
		  <script type="text/javascript" charset="utf-8">
		    $('select[name=info[parent_id]]').change(function(){
		      if (this.value > 0) {
		        $(this).parent().next().show();
		      } else {
		        $(this).parent().next().hide();
		      }
		    });
		  </script>
			<div class="clearfix m10"><input type="submit" class="fr btn_fb" value="" /></div>
		</div>
		<div class="center">
			<div class="input_title">
				菜单名称：<input name="info[name]" type="text" value="{$info.name}" />
			</div>
			<div class="input_title">
				菜单排序：<input name="info[view_order]" type="text" value="{$info.view_order}" />
			</div>
		</div>
	</div>
	</form>
</div>
<!--/main-->
{include file="lib/footer.html"}